﻿using System;
using System.Drawing;

namespace AppRPG
{
	public class Player
	{
		private readonly string _playerName;
		
		private readonly Size _dimension;
		private readonly Image _texture;

        private readonly float _timeToUpdate;
		
		private bool _isCanMove;
		
		private float _elapsedTime;
		
		private Point _position;
		
		public Player(Point position, Size dimension, Image texture, 
		              string name, float timeToUpdate)
		{
			_position = position;
			
			_dimension = dimension;
			_texture = new Bitmap(texture, dimension);
			
			_timeToUpdate = timeToUpdate;
			
			_playerName = name;
			
			_isCanMove = false;
		}
		
		private void MakeActions()
		{
			
		}
		
		private void AddToElapsedTime(float deltaTime)
		{
			_elapsedTime += deltaTime;
		}
		
		public void Update(float deltaTime)
		{
			AddToElapsedTime(deltaTime);
			
			if (_elapsedTime >= _timeToUpdate)
			{
				MakeActions();
			}
		}
		
		public Point GetPosition()
		{
			return _position;
		}
		
		public Size GetDimension()
		{
			return _dimension;
		}
		
		public void SetCanMove(bool isCanMove)
		{
			_isCanMove = isCanMove;
		}
		
		public void Draw(Graphics graphics)
		{
			graphics.DrawImage(_texture, _position);
		}
	}
}
